/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Language:  C++
Date:      $Date: 2010-02-10 23:22:10 +0800 (周三, 10 二月 2010) $
Version:   $Revision: 21278 $

Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/


#ifndef MITK_CONTOUR_MAPPER_OVERLAY_H_
#define MITK_CONTOUR_MAPPER_OVERLAY_H_

#include "mitkCommon.h"
#include "WxExtentionExports.h"
#include "mitkGLMapper2D.h"


namespace mitk {

class BaseRenderer;
class Contour;

/** 
 * @brief OpenGL-based mapper to display a mitk::Contour object in a 2D render window 
 * 
 * 
 * @ingroup Mapper
 */
class WxExtention_EXPORT WxContourMapperOverlay : public GLMapper2D
{
public:
    
    mitkClassMacro(WxContourMapperOverlay, Mapper2D);

    itkNewMacro(Self);

    /**
     * reimplemented from Baseclass
     */
    virtual void MitkRenderOpaqueGeometry(mitk::BaseRenderer* renderer){}
    virtual void MitkRenderTranslucentGeometry(mitk::BaseRenderer* renderer){}
#if ( ( VTK_MAJOR_VERSION >= 5 ) && ( VTK_MINOR_VERSION>=2)  )
    void MitkRenderVolumetricGeometry(mitk::BaseRenderer* renderer){}
#endif
    virtual void MitkRenderOverlay(mitk::BaseRenderer* renderer)
    {
        if(IsVisible(renderer)==false)
          return;

        Paint(renderer);
    }

    virtual void Paint(BaseRenderer * renderer);

    /**
     * return a refernce of the rendered data object 
     */
    const Contour* GetInput(void);

    /*
     * This is taken from the FAQ of comp.graphics.algorithms
     *
     * http://www.exaflop.org/docs/cgafaq/cga2.html
     *
     * This FAQ references:
     *
     *   Graphics Gems IV, Paul S. Heckbert (ed.), Academic Press 1994, ISBN 0-12-336155-9
     *   Computational Geometry in C (2nd Ed.), Joseph O'Rourke, Cambridge University Press 1998, ISBN 0-521-64010-5
     *   An Introduction to Ray Tracing, Andrew Glassner (ed.), Academic Press 1989, ISBN 0-12-286160-4
     *
    */
   static bool ipMITKSegmentationIsInsideContour( float *contour, int sizeContour, float x, float y );

protected:
    WxContourMapperOverlay();

    virtual ~WxContourMapperOverlay();
};

} // namespace mitk



#endif /* MITKWxContourMapperOverlay_H_HEADER_INCLUDED */
